package com.hqd.ch03.v46.beans.property;

import com.hqd.ch03.v46.beans.BeansException;
import com.hqd.ch03.v46.beans.PropertyValues;
import com.hqd.ch03.v46.config.PropertyValue;
import com.hqd.ch03.v46.core.convert.TypeDescriptor;

import java.util.Map;

/**
 * bean操作属性接口
 */
public interface PropertyAccessor {
    String NESTED_PROPERTY_SEPARATOR = ".";

    char NESTED_PROPERTY_SEPARATOR_CHAR = '.';

    String PROPERTY_KEY_PREFIX = "[";

    char PROPERTY_KEY_PREFIX_CHAR = '[';

    String PROPERTY_KEY_SUFFIX = "]";

    char PROPERTY_KEY_SUFFIX_CHAR = ']';


    boolean isReadableProperty(String propertyName);

    boolean isWritableProperty(String propertyName);

    Class<?> getPropertyType(String propertyName) throws BeansException;

    TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException;


    Object getPropertyValue(String propertyName) throws BeansException;

    void setPropertyValue(String propertyName, Object value) throws BeansException;

    void setPropertyValue(PropertyValue pv) throws BeansException;

    void setPropertyValues(Map<?, ?> map) throws BeansException;

    void setPropertyValues(PropertyValues pvs) throws BeansException;

    void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown)
            throws BeansException;

    void setPropertyValues(PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid)
            throws BeansException;

}
